package com.trivia.restServices

import com.trivia.Level;
import com.trivia.restResponses.GetQuestionsAndAnswersResponse;
import com.trivia.restResponses.ServerResponse;

class GetQuestionsController extends AbstractController {

	def questionService
	
	def index = {
		execute()
	}
	
    def executeTry(){
		Level level = Level.get(Long.parseLong(params.levelID)) 
		List questions = questionService.getQuestions(level) 
		
		response = new GetQuestionsAndAnswersResponse(status: ServerResponse.okResponse, 
						description: ServerResponse.responses[ServerResponse.okResponse],questions:questions)
    }

}
